setMaxLifecycle

Set a ceiling for the state of an active fragment in this FragmentManager. If fragment is already above the received state, it will be forced down to the correct state.

The fragment provided must currently be added to the FragmentManager to have it's Lifecycle state capped, or previously added as part of this transaction. If the INITIALIZED is passed in as the Lifecycle.State and the provided fragment has already moved beyond INITIALIZED, an IllegalArgumentException will be thrown.

If the DESTROYED is passed in as the Lifecycle.State an IllegalArgumentException will be thrown.

Return

the same FragmentTransaction instance

Parameters

fragment

the fragment to have it's state capped.

state

the ceiling state for the fragment.